home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / SAS-C / sc655pch / amiproc / test.c < prev   
Encoding:
C/C++ Source or Header  |  1995-01-09  |  844 b   |  33 lines

  1. #include "amiproc.h"
  2.  
  3. #include <stdio.h>
  4.  
  5. /* Declare some __near external data.  This is reallocated for  */
  6. /* each new subprocess, so all processes have their own private */
  7. /* copy.  When the copy is first made, it will have the value   */
  8. /* it's being set to here, even if the parent has changed it.   */
  9. char *ext = "This is the original value of ext";
  10.  
  11. int subprocess(void *arg)
  12. {
  13.    printf("%s: ext = \"%s\"\n\n", arg, ext);
  14.    return 0;
  15. }
  16.  
  17. void main(void)
  18. {
  19.    struct AmiProcMsg *first, *second;
  20.    
  21.    first = AmiProc_Start(subprocess, "First subprocess");
  22.  
  23.    subprocess("Original process, before resetting externs");
  24.  
  25.    ext = "This is the new value of ext";
  26.    second = AmiProc_Start(subprocess, "Second subprocess");
  27.  
  28.    subprocess("Original process, after resetting externs");
  29.  
  30.    AmiProc_Wait(first);
  31.    AmiProc_Wait(second);
  32. }
  33.